home *** CD-ROM | disk | FTP | other *** search
-
- While researching the prospects of disk-caching on the ST I wrote a little
- program that makes a record of all the calls to rwabs(). Looking at the
- recordings I found some interesting bits of information:
-
- When TOS accesses the boot sector, it reads TWO sectors. I don't know why,
- the second sector is part of the (first) FAT, and the (second) FAT is read
- separately.
-
- The FAT (logical sectors 6-10) and root directory (11-17) are read on an
- incremental basis, one sector at a time and only as far as necessary at the
- moment.
-
- Sometimes TOS reads the first directory sector (#11) twice in succession.
- I suspect the first time is to look at the disk ID. Inefficiency...
-
- The last sector to be written in a file is read first, then written -
- presumably to enable partial overwriting of a file, but it's useless when
- simply copying a complete file...
-
- When a disk's desktop window is closed and reopened, the boot sector (#0)
- is read, even if the disk was not removed. (That sector holds the info
- as to whether the disk is double-sided, etc.) If you just hit <ESC>
- the disk turns (the root directory is re-read) but the boot sector is
- NOT read, unless the disk has been removed!
-
- When you drag an icon to copy a file, a LONG sequence of calls to rwabs()
- occurs. Here is an example, copying a 4-sector (2K) file from D: to A:,
- overwriting an old version of it on the floppy: (R/W for read/write,
- A/D for the drives, then sector numbers in HEX)
-
- RDB RAB RAB RAC RAD RAB RAC RAD RA7 WA7 WA2 WAD WAD
- RD<2 data sectors> RD6 RD<2 data sectors> RD6 RD7
- WA<3 data sectors> RA<1 sector> (read-before write)
- RAD WA7 WA2 WAD WA<last data sector> RAD WAD RDB
-
- AMAZING, isn't it? Now I wonder how come you swap disks only twice!
- Notice also how many track repositionings you can save by just caching
- sectors 6...13 there. BTW, one "cc" command (using uCsh and Megamax
- to compile a SMALL program) caused 175 calls to rwabs(), of which 22
- were for FAT or root-directory sectors (even though all the programs
- invoked were in a subdirectory).
-
- In the process of reading a file, TOS will read many consecutive sectors
- with ONE call to rwabs() - but will sometimes read several in separate
- calls, even though they ARE consecutive! I don't see the method there,
- although a given file from a given disk is always read the same way.
-
- A note about micro-C-Shell: It never reads the boot sector via rwabs(),
- even when a DS disk is replaced by a SS one. It MUST be reading it
- directly, e.g. using floprd(). It DOES read the first directory sector
- (#11), via rwabs(), and TWICE (as mentioned above).
-
- Hope this helps you understand TOS a little bit better.
- (If you experts knew all of this all along, than why didn't you tell us?? :-)
- The program I used is available upon request.
-
- - Moshe Braner
-